<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" indent="yes" encoding="UTF-8"/>

	<xsl:template name="show_module">
		<xsl:param name="name"/>
		<module name="{$name}"/>
	</xsl:template>

	<xsl:template name="show_repetition">
		<xsl:param name="name"/>
		<xsl:choose>
		<xsl:when test="count(/document/contents/repetition[@name=$name])&gt;0">
		<xsl:for-each select="/document/contents/repetition[@name=$name]">
			<xsl:sort select="@sort" data-type="number"/>
			<xsl:if test="/document/editmode='1'">
				<div style="margin:0px;padding:0px;background-color:#eeeeee;border:1px solid #000000;">
					<xsl:call-template name="edit_repetition">
						<xsl:with-param name="name" select="$name"/>
					</xsl:call-template>
				</div>
			</xsl:if>
			<xsl:call-template name="show_repetition_content">
				<xsl:with-param name="path" select="./@id"/>
			</xsl:call-template>
		</xsl:for-each>
		</xsl:when>
		<xsl:otherwise>
			<xsl:if test="/document/editmode='1'">
				<div style="margin:0px;padding:0px;background-color:#eeeeee;border:1px solid #000000;">
					<xsl:if test="position()=1">
						<xsl:call-template name="add_repetition">
							<xsl:with-param name="name" select="$name"/>
						</xsl:call-template>
					</xsl:if>
				</div>
			</xsl:if>
		</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="show_repetition_templates">
		<xsl:param name="repetitionid"/>
			<span style="font-weight: bold; padding:0px; margin:0px; font-size:10px; font-family:Arial,Verdana,sans-serif; color:#000000; text-decoration: none;"><xsl:text disable-output-escaping="yes">Textbl&amp;ouml;cke</xsl:text></span><br/>
			<xsl:for-each select="/document/blocktemplates/block">
				<a href="{/document/filename}&amp;repetitionid={$repetitionid}&amp;select_block_template={.}.xsl" style="padding:0px; margin:0px; font-size:10px; font-family:Arial,Verdana,sans-serif; color:#000000; text-decoration: none;">
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
					<xsl:if test="//repetition[@id=$repetitionid]/@template=concat(.,'.xsl')">
						<xsl:text disable-output-escaping="yes">&amp;raquo; </xsl:text>
					</xsl:if>
					<xsl:value-of select="translate(.,'_',' ')"/>
				</a><br/>
			</xsl:for-each>
			<span style="font-weight: bold; padding:0px; margin:0px; font-size:10px; font-family:Arial,Verdana,sans-serif; color:#000000; text-decoration: none;"><xsl:text disable-output-escaping="yes">Module</xsl:text></span><br/>
			<xsl:for-each select="/document/modules/modul">
				<a href="{/document/filename}&amp;repetitionid={$repetitionid}&amp;select_block_template=mod_{.}" style="padding:0px; margin:0px; font-size:10px; font-family:Arial,Verdana,sans-serif; color:#000000; text-decoration: none;">
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
					<xsl:if test="//repetition[@id=$repetitionid]/@module=.">
						<xsl:text disable-output-escaping="yes">&amp;raquo; </xsl:text>
					</xsl:if>
					<xsl:value-of select="translate(.,'_',' ')"/>
				</a><br/>
			</xsl:for-each>
	</xsl:template>

	<xsl:template name="show_repetition_content">
		<xsl:param name="path"/>
		<xsl:for-each select="//repetition[@id=$path]">
			<xsl:value-of select="./rendered" disable-output-escaping="yes"/>
		</xsl:for-each>
	</xsl:template>

	<xsl:template name="add_repetition">
		<xsl:param name="name"/>
		<xsl:if test="/document/editmode='1'">
			<a href="{/document/filename}&amp;addrepetition={$name}" style="padding:0px; margin:0px; font-size:10px; font-family:Arial,Verdana,sans-serif; color:#000000; text-decoration: none;">
				<xsl:text disable-output-escaping="yes">Wiederholung hinzuf&amp;uuml;gen</xsl:text>
				<!--
				Replaced by mthie for the menu-variant
				<img src="/images/plus.gif" border="0" width="16" height="16" alt="Wiederholung hinzufügen - {$name}" title="Wiederholung hinzufügen - {$name}"/>
				-->
			</a>
		</xsl:if>
	</xsl:template>

	<xsl:template name="edit_repetition">
		<xsl:param name="name"/>
		<xsl:if test="/document/editmode='1'">
			<a href="#" onclick="changerep('{./@id}')">
				<img src="images/edit.gif" border="0" width="12" height="16" alt="Wiederholung bearbeiten - {$name}" title="Wiederholung bearbeiten - {$name}"/>
			</a>
			<div id="repi{./@id}" style="visibility:hidden; height:0px; width: 0px;">
				<div id="rep{./@id}" style="position:absolute; padding:2px 3px 2px 3px; border: 1px solid #000000; background-color: #eeeeee;">
					<xsl:if test="position()=1">
						<xsl:call-template name="add_repetition">
							<xsl:with-param name="name" select="$name"/>
						</xsl:call-template><br/>
					</xsl:if>
					<xsl:call-template name="del_repetition">
						<xsl:with-param name="id" select="./@id"/>
					</xsl:call-template><br/>
					<xsl:if test="position()&gt;1">
						<a href="{/document/filename}&amp;move_rep_up={./@id}" style="padding:0px; margin:0px; font-size:10px; font-family:Arial,Verdana,sans-serif; color:#000000; text-decoration: none;">
							<img src="images/sort_up.gif" width="16" height="16" alt="Nach oben" title="Nach oben" border="0"/><xsl:text disable-output-escaping="yes"> Nach oben verschieben</xsl:text>
						</a><br/>
					</xsl:if>
					<xsl:if test="position()&lt;last()">
						<a href="{/document/filename}&amp;move_rep_down={./@id}" style="padding:0px; margin:0px; font-size:10px; font-family:Arial,Verdana,sans-serif; color:#000000; text-decoration: none;">
							<img src="images/sort_down.gif" width="16" height="16" alt="Nach unten" title="Nach unten" border="0"/><xsl:text disable-output-escaping="yes"> Nach unten verschieben</xsl:text>
						</a><br/>
					</xsl:if>
					<xsl:call-template name="show_repetition_templates">
						<xsl:with-param name="repetitionid" select="./@id"/>
					</xsl:call-template>
				</div>
			</div>
		</xsl:if>
	</xsl:template>

	<xsl:template name="del_repetition">
		<xsl:param name="id"/>
		<xsl:if test="/document/editmode='1'">
			<a href="javascript:askdelete('{/document/admin_url}{/document/filename}&amp;delrepetition={$id}')" style="padding:0px; margin:0px; font-size:10px; font-family:Arial,Verdana,sans-serif; color:#000000; text-decoration: none;">
				<img src="/images/delete.gif" border="0" width="16" height="16" alt="Wiederholung löschen"/>
				<xsl:text disable-output-escaping="yes"> Wiederholung l&amp;ouml;schen</xsl:text>
			</a>
		</xsl:if>
	</xsl:template>

	<xsl:template name="graphicfield">
		<xsl:param name="align" select="''"/>
		<xsl:param name="width" select="''"/>
		<xsl:param name="height" select="''"/>
		<xsl:param name="border" select="'0'"/>
		<xsl:param name="repetition" select="./@id"/>
		<xsl:param name="name"/>
		<xsl:param name="padding" select="'0px;'"/>
		<xsl:param name="margin" select="'0px;'"/>
		<xsl:choose>
			<xsl:when test="/document/editmode='1'">
				<script language="JavaScript" type="text/javascript">
				<xsl:comment>
					function opengraphicwindow<xsl:value-of select="concat(./@id,image[@name=$name]/@id,$name)"/>() {
						window.open('admin_content_editgraphic.php?<xsl:value-of select="/document/filenamezusatz"/>&amp;editrepetition=<xsl:value-of select="$repetition"/>&amp;editimage=<xsl:value-of select="$name"/>','graphicwindow','width=500,height=400,scrollbars=yes');
					}
				// </xsl:comment>
				</script>
				<a href="javascript:opengraphicwindow{concat(./@id,image[@name=$name]/@id,$name)}()">
					<img src="images/edit.gif" border="0" width="12" height="16" alt="Feld bearbeiten">
						<xsl:if test="$align!=''">
							<xsl:attribute name="align"><xsl:value-of select="$align"/></xsl:attribute>
						</xsl:if>
					</img>
				</a>
			</xsl:when>
		</xsl:choose>
		<xsl:choose>
			<xsl:when test="image[@name=$name]/@link!='' and image[@name=$name]/@link!='0'">
				<a href="link://{image[@name=$name]/@link}">
					<xsl:call-template name="show_graphicfieldimage">
						<xsl:with-param name="align" select="$align"/>
						<xsl:with-param name="width" select="$width"/>
						<xsl:with-param name="height" select="$height"/>
						<xsl:with-param name="padding" select="$padding"/>
						<xsl:with-param name="border" select="$border"/>
						<xsl:with-param name="margin" select="$margin"/>
						<xsl:with-param name="image" select="image[@name=$name]"/>
					</xsl:call-template>
				</a>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="show_graphicfieldimage">
					<xsl:with-param name="align" select="$align"/>
					<xsl:with-param name="width" select="$width"/>
					<xsl:with-param name="height" select="$height"/>
					<xsl:with-param name="padding" select="$padding"/>
					<xsl:with-param name="border" select="$border"/>
					<xsl:with-param name="margin" select="$margin"/>
					<xsl:with-param name="image" select="image[@name=$name]"/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="show_graphicfieldimage">
		<xsl:param name="align" select="''"/>
		<xsl:param name="width" select="''"/>
		<xsl:param name="height" select="''"/>
		<xsl:param name="border" select="'0'"/>
		<xsl:param name="padding" select="'0px;'"/>
		<xsl:param name="margin" select="'0px;'"/>
		<xsl:param name="image" select="''"/>
		<img src="image://{$image}" style="padding:{$padding} margin:{$margin}">
			<xsl:if test="$width!=''">
				<xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
			</xsl:if>
			<xsl:if test="$height!=''">
				<xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute>
			</xsl:if>
			<xsl:if test="$align!=''">
				<xsl:attribute name="align"><xsl:value-of select="$align"/></xsl:attribute>
			</xsl:if>
			<xsl:if test="$border!=''">
				<xsl:attribute name="border"><xsl:value-of select="$border"/></xsl:attribute>
			</xsl:if>
		</img>
	</xsl:template>

	<xsl:template name="editfield">
		<xsl:param name="repetition" select="./@id"/>
		<xsl:param name="name"/>
		<xsl:param name="css" select="'p'"/>
		<xsl:param name="bgcolor" select="'#ffffff'"/>
		<xsl:choose>
			<xsl:when test="block[@name=$name]/@edit='1'">
				<xsl:call-template name="rtffield">
					<xsl:with-param name="name" select="$name"/>
					<xsl:with-param name="css" select="$css"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:choose>
					<xsl:when test="/document/editmode='1'">
						<script language="JavaScript" type="text/javascript">
						<xsl:comment>
							function openeditwindow<xsl:value-of select="concat(./@id,block[@name=$name]/@id,$name)"/>() {
								window.open('admin_content_editfield.php?<xsl:value-of select="/document/filenamezusatz"/>&amp;editrepetition=<xsl:value-of select="$repetition"/>&amp;editblock=<xsl:value-of select="$name"/>','editwindow','width=500,height=400,scrollbars=yes');
							}
						// </xsl:comment>
						</script>
						<a href="javascript:openeditwindow{concat(./@id,block[@name=$name]/@id,$name)}()">
							<img src="images/edit.gif" border="0" width="12" height="16" alt="Feld bearbeiten"/>
						</a>
					</xsl:when>
				</xsl:choose>
				<xsl:value-of select="block[@name=$name]" disable-output-escaping="yes"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="rtffield">
		<xsl:param name="name"/>
		<xsl:param name="css"/>
		<xsl:param name="bgcolor"/>
		<a name="{$name}">
			<xsl:text> </xsl:text>
		</a>
		<form action="{/document/filename}" method="post" onsubmit="return submitForm();">
			<input type="hidden" name="edittextblock" value="{block[@name=$name]/@name}"/>
			<input type="hidden" name="edittextblockrepetition" value="{block/../@id}"/>
			<script language="JavaScript" type="text/javascript">
				<xsl:comment><xsl:text disable-output-escaping="yes">
function submitForm() {
	//make sure hidden and iframe values are in sync before submitting form
	//to sync only 1 rte, use updateRTE(rte)
	//to sync all rtes, use updateRTEs
	updateRTE('rte1');
	//updateRTEs();
	//change the following line to true to submit form
	return true;
}

//Usage: initRTE(imagesPath, includesPath, cssFile, genXHTML, cssclass, bgcolor, presence)
initRTE("rte/images/", "/rte/", "</xsl:text>
				<xsl:value-of select="concat(/document/production_url,'/css/style.css')"/>
				<xsl:text disable-output-escaping="yes">", true, "</xsl:text>
				<xsl:value-of select="$css"/>
				<xsl:text disable-output-escaping="yes">", "</xsl:text>
				<xsl:value-of select="$bgcolor"/>
				<xsl:text disable-output-escaping="yes">", "</xsl:text>
				<xsl:value-of select="/document/presence"/>
				<xsl:text disable-output-escaping="yes">");
// </xsl:text></xsl:comment>
			</script>
			<noscript>
				<p>
					<b>Javascript must be enabled to use this form.</b>
				</p>
			</noscript>
			<script language="JavaScript" type="text/javascript">
				<xsl:comment><xsl:text disable-output-escaping="yes">
//Usage: writeRichText(fieldname, html, width, height, buttons, readOnly)
writeRichText('rte1', '</xsl:text>
				<xsl:value-of select="block[@name=$name]" disable-output-escaping="yes"/>
				<xsl:text disable-output-escaping="yes">', 400, 150, true, false);
// </xsl:text></xsl:comment>
			</script>
			<input type="submit" value="Speichern"/>
			<input type="button" value="Fenster schliessen" onclick="closewindow()"/>
		</form>
	</xsl:template>
</xsl:stylesheet><!-- Stylesheet edited using Stylus Studio - (c)1998-2004. Sonic Software Corporation. All rights reserved. -->